﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
            {
            int yearInput = 2015;   //1 - создание массива 1000лет кол-ва пятниц 13-го
            int[] arrayYears = new int[1000];
            for (int j = 0; j < 1000; j++)
                {
                    DateTime dt = new DateTime(yearInput, 1, 1);
                do
                {
                    if (dt.DayOfWeek == DayOfWeek.Friday)
                    {
                        if (dt.Day == 13)
                        {
                            arrayYears[j]++;
                            dt = dt.AddDays(7);
                        }
                        else
                        {
                            dt = dt.AddDays(7);
                        }
                    }
                    else
                    {
                        dt = dt.AddDays(1);
                    }
                }
                while (dt.Year == yearInput);
                    yearInput++;
                }
                 
            int[] years = new int [1000]; //инициализация массива годов
            for (int i = 0; i < years.Length; i++)
            {
                years[i] = 2015 + i;
            }

            for (int i = 0; i < arrayYears.Length; i++) //сортировка по максимуму и привязка годов к данным
            {
                for (int j = i + 1; j < arrayYears.Length; j++)
                {
                    if (arrayYears[i] < arrayYears[j])
                    {
                        int a = arrayYears[i];
                        arrayYears[i] = arrayYears[j];
                        arrayYears[j] = a;
                        int b = years[i];
                        years[i] = years[j];
                        years[j] = b;


                    }
                }
            }
            for (int i = 0; i < 10; i++) //цикл вывода на экран
                {
                Console.WriteLine(years[i] + "   " + arrayYears[i]);
            }
            Console.ReadLine();
        }
    }
}


